package com.away.fuckingworld.entity.dto;

import com.away.fuckingworld.entity.DoubleColorBallHistory;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;

import java.util.List;

/**
 * 接口返回的DTO
 */
@Data
public class SSQCWLDTO {


    /**
     * name : 双色球
     * code : 2013001
     * detailsLink : /c/2013-01-01/384379.shtml
     * videoLink :
     * date : 2013-01-01(二)
     * week : 二
     * red : 06,08,14,15,24,25
     * blue : 06
     * blue2 :
     * sales : 309153922
     * poolmoney : 30000000
     * content : 河北1注,山西1注,上海2注,江苏1注,浙江1注,山东3注,湖南1注,广东7注,广西1注,四川1注,云南1注,共20注。
     * addmoney : 5000000
     * addmoney2 :
     * msg : 中彩中心决定：从双色球调节基金拨出12541580元，注入第2013002期奖池，第2013002期奖池资金原为：17458420.00元,累计金额为：30000000.00元。
     * z2add :
     * m2add :
     * prizegrades : [{"type":1,"typenum":"20","typemoney":"5250000（含加奖250000）"},{"type":2,"typenum":"271","typemoney":"71485"},{"type":3,"typenum":"2102","typemoney":"3000"},{"type":4,"typenum":"86580","typemoney":"200"},{"type":5,"typenum":"1412922","typemoney":"10"},{"type":6,"typenum":"9831878","typemoney":"5"},{"type":7,"typenum":"","typemoney":""}]
     */

    private String name;
    private String code;
    private String detailsLink;
    private String videoLink;
    private String date;
    private String week;
    private String red;
    private String blue;
    private String blue2;
    private String sales;
    private String poolmoney;
    private String content;
    private String addmoney;
    private String addmoney2;
    private String msg;
    private String z2add;
    private String m2add;

    public DoubleColorBallHistory toDoubleColorBallHistory(){
        DoubleColorBallHistory po = new DoubleColorBallHistory();
        po.setCode(this.getCode());
        po.setDate(this.getDate().substring(0,10));
        String[] reds = StringUtils.split(this.getRed(), ",");
        po.setBall1(reds[0]);
        po.setBall2(reds[1]);
        po.setBall3(reds[2]);
        po.setBall4(reds[3]);
        po.setBall5(reds[4]);
        po.setBall6(reds[5]);
        po.setBall7(this.getBlue());
        return po;
    }
}
